<?php 
class defaultComponents extends  sfComponents
{
	public function executeBreadcrumbs()
	{
		$controller = $this->getContext()->getModuleName();
		$this->module_link = array();

		switch ($controller) {
			case 'articles':
				$this->module_link['title'] = 'Статьи';
				$this->module_link['route'] = 'articles/index';
			break;
			case 'releases':
				$this->module_link['title'] = 'Релизы';
				$this->module_link['route'] = 'releases/index';
			break;
			case 'news':
				$this->module_link['title'] = 'Новости';
				$this->module_link['route'] = 'news/index';
			break;
			
			default:
			break;
		}
	}

	public function executeArticles_categories()
	{
		$this->categories = Doctrine::getTable('ArticleCategory')->findAll();

		$query = Doctrine_Query::create() //Doctrine::getTable('Article')->createQuery()
			->from('article a')
			->leftJoin('a.ArticleCategory category')
			->orderBy('a.updated_at DESC')
			->limit(3);

		$this->articles = $query->execute();
	}

	public function executeReleases_categories()
	{
		$this->categories = Doctrine::getTable('RelizCategory')->findAll();

//		$query = Doctrine_Query::create() //Doctrine::getTable('Article')->createQuery()
//			->from('reliz r')
//			->leftJoin('r.RelizCategory category')
//			->orderBy('r.updated_at DESC')
//			->limit(3);
//
//		$this->releases = $query->execute();
	}

	public function executeForum()
	{
		
	}
	
	public function executeLoginbox(sfWebRequest $request)
	{
		$this->form = new sfGuardFormSignin();
	}
	public function executeCloudtags(sfWebRequest $request)
	{
		$this -> cloud = SettingsData::Get_it(SettingsData::CLOUD_TAG);
	}
}
?>